package gpflag

import (
	"flag"
	"fmt"
	"os"
)

var (
	help       bool
	baseDir    string //The dir contains device_settings.yml
	bindAddr   string
	listenPort int
	tunDevice  string
	logFile    string
)

func main(){
	var err error
	flag.Parse()
	if help {
		flag.Usage()
		return
	}
	defer func() {
		if err != nil {
			os.Exit(1)
		}
	}()
	//goto
}

func init() {
	flag.BoolVar(&help, "h", false, "This help text")
	flag.StringVar(&baseDir, "d", "/opt/tna", "DIR of config files")
	flag.StringVar(&bindAddr, "b", "127.0.0.1", "API bind address")
	flag.IntVar(&listenPort, "p", 8102, "API listen port")
	flag.StringVar(&tunDevice, "tun", "", "TUN device path in dev fs")
	flag.StringVar(&logFile, "log", "", "Path of log file")
	flag.Usage = func() {
		fmt.Printf("Usage: %s [-h] [-c CONF_FILE]\n", os.Args[0])
		flag.PrintDefaults()
	}
}
